package com.ce.socket;

import org.apache.log4j.Logger;


public abstract class BsSocket {
	private static Logger log = Logger.getLogger(BsSocket.class);
	protected String host;
	protected int port;
	protected int timeout;
	protected int connectTimeout;
	protected boolean noDelay;

	public BsSocket(String host, int timeout, int connectTimeout, boolean noDelay) {
		String[] ip = host.split(":");
		this.host = ip[0];
		this.port = Integer.parseInt(ip[1]);
		this.timeout = timeout;
		this.connectTimeout = connectTimeout;
		this.noDelay = noDelay;
	}
	
	public BsSocket(String host, int port, int timeout, int connectTimeout, boolean noDelay) {
		this.host = host;
		this.port = port;
		this.timeout = timeout;
		this.connectTimeout = connectTimeout;
		this.noDelay = noDelay;
	}
	
	protected String toParam() {
		return "[host=" + (host==null?"null":host)
				+ ", port=" + port
				+ ", timeout=" + timeout
				+ ", connectTimeout=" + connectTimeout
				+ ", noDelay=" + noDelay;
	}
}
